package com.zhanglinfeng.eurekafeign.controller;

import com.zhanglinfeng.api.response.ResultResponse;
import com.zhanglinfeng.api.service.TestFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
public class TestController {

    @Autowired
    private TestFeign testFeign;

    @GetMapping(value = "/queryServices", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResultResponse<List<String>> queryServices() {
        return testFeign.queryServices();
    }

    @PostMapping(value = "/uploadFile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public String handleFileUpload(@RequestPart(value = "file") MultipartFile file) {
        return testFeign.handleFileUpload(file);
    }
}
